package com.qumitech.visualnovel.service.account;

import com.qumitech.visualnovel.datasource.console.SysRoleMapper;
import com.qumitech.visualnovel.model.dao.console.SysRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRoleServiceImpl implements SysRoleService {

    @Autowired
    SysRoleMapper sysRoleMapper;

    @Override
    public List<SysRole> getSysRoleList(int offset, int pageSize, String orderBy, String orderType) {
        return sysRoleMapper.getSysRoleList(offset, pageSize, orderBy, orderType);
    }

    @Override
    public int getSysRoleCount() {
        return sysRoleMapper.getSysRoleCount();
    }

    @Override
    public SysRole getSysRoleById(int id) {
        return sysRoleMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insertSysRole(String roleName, String description, boolean available) {
        return sysRoleMapper.insertSysRole(roleName,description,available);
    }

    @Override
    public SysRole getSysRoleByRoleName(String roleName) {
        return sysRoleMapper.getSysRoleByRoleName(roleName);
    }

    @Override
    public int UpdateBySysRole(SysRole sysRole) {
        return sysRoleMapper.updateByPrimaryKey(sysRole);
    }

    @Override
    public int deleteByPrimaryKey(int roleId) {
        return sysRoleMapper.deleteByPrimaryKey(roleId);
    }
}
